(function(b) {
    var c = mobiscroll,
        a = c.$,
        d = {
            batch: 50,
            min: 0,
            max: 100,
            defaultUnit: '',
            units: null,
            unitNames: null,
            invalid: [],
            sign: false,
            step: 0.05,
            scale: 2,
            convert: function(a) {
                return a;
            },
            signText: '&nbsp;',
            wholeText: 'Whole',
            fractionText: 'Fraction',
            unitText: 'Unit'
        };
    c.presets.scroller.measurement = function(u) {
        var V = a.extend({}, u.settings),
            c = a.extend(u.settings, d, V),
            D = {},
            z = [
                []
            ],
            q = {},
            w = {},
            C = {},
            J = [],
            f = c.sign,
            m = c.units && c.units.length,
            t = m ? c.defaultUnit || c.units[0] : '',
            B = [],
            g = c.step < 1,
            j = c.step > 1 ? c.step : 1,
            I = g ? Math.max(c.scale, (c.step + '').split('.')[1].length) : 1,
            y = Math.pow(10, I),
            p = Math.round(g ? c.step * y : c.step),
            S, h, v, Q = -1,
            s, i, A, o, n, k, r, O, L, F = 0,
            G = 0,
            H, e, l = 0;

        function U(a) {
            return Math.max(k, Math.min(r, g ? a < 0 ? Math.ceil(a) : Math.floor(a) : M(Math.round(a - F), p) + F));
        }

        function K(a) {
            return g ? M((Math.abs(a) - Math.abs(U(a))) * y - G, p) + G : 0;
        }

        function E(a) {
            var b = U(a),
                c = K(a),
                d = a < 0 ? '-' : '+';
            if (c >= y) {
                if (a < 0) {
                    b--;
                } else {
                    b++;
                }
                c = 0;
            }
            return [d, b, c];
        }

        function R(a) {
            var b = +a[i],
                c = g ? a[s] / y * (b < 0 ? -1 : 1) : 0;
            return (f && a[0] == '-' ? -1 : 1) * (b + c);
        }

        function M(b, a) {
            return Math.round(b / a) * a;
        }

        function W(a, b) {
            a = a + '';
            while (a.length < b) {
                a = '0' + a;
            }
            return a;
        }

        function x(a, b, d) {
            if (b === d || !c.convert) {
                return a;
            }
            return c.convert.call(this, a, b, d);
        }

        function P(a, b, c) {
            a = a > c ? c : a;
            a = a < b ? b : a;
            return a;
        }

        function N(d) {
            var a, b;
            o = x(c.min, t, d);
            n = x(c.max, t, d);
            if (g) {
                k = o < 0 ? Math.ceil(o) : Math.floor(o);
                r = n < 0 ? Math.ceil(n) : Math.floor(n);
                O = K(o);
                L = K(n);
            } else {
                k = Math.round(o);
                r = Math.round(n);
                r = k + Math.floor((r - k) / p) * p;
                F = k % p;
            }
            a = k;
            b = r;
            if (f) {
                b = Math.abs(a) > Math.abs(b) ? Math.abs(a) : Math.abs(b);
                a = a < 0 ? 0 : a;
            }
            w.min = a < 0 ? Math.ceil(a / j) : Math.floor(a / j);
            w.max = b < 0 ? Math.ceil(b / j) : Math.floor(b / j);
        }

        function T(a) {
            return R(a).toFixed(g ? I : 0) + (m ? ' ' + B[a[A]] : '');
        }
        u.setVal = function(b, c, d, e, f) {
            u._setVal(a.isArray(b) ? T(b) : b, c, d, e, f);
        };
        if (c.units) {
            for (e = 0; e < c.units.length; ++e) {
                H = c.units[e];
                B.push(c.unitNames ? c.unitNames[H] || H : H);
            }
        }
        if (f) {
            f = false;
            if (m) {
                for (e = 0; e < c.units.length; e++) {
                    if (x(c.min, t, c.units[e]) < 0) {
                        f = true;
                    }
                }
            } else {
                f = c.min < 0;
            }
        }
        if (f) {
            z[0].push({
                data: ['-', '+'],
                label: c.signText
            });
            Q = l++;
        }
        w = {
            label: c.wholeText,
            data: function(a) {
                return k % j + a * j;
            },
            getIndex: function(a) {
                return Math.round((a - k % j) / j);
            }
        };
        z[0].push(w);
        i = l++;
        N(t);
        if (g) {
            z[0].push(C);
            C.data = [];
            C.label = c.fractionText;
            for (e = G; e < y; e += p) {
                J.push(e);
                C.data.push({
                    value: e,
                    display: '.' + W(e, I)
                });
            }
            s = l++;
            S = Math.ceil(100 / p);
            if (c.invalid && c.invalid.length) {
                a.each(c.invalid, function(c, b) {
                    var a = b > 0 ? Math.floor(b) : Math.ceil(b);
                    if (a === 0) {
                        a = b <= 0 ? -0.001 : 0.001;
                    }
                    q[a] = (q[a] || 0) + 1;
                    if (b === 0) {
                        a = 0.001;
                        q[a] = (q[a] || 0) + 1;
                    }
                });
                a.each(q, function(a, b) {
                    if (b < S) {
                        delete q[a];
                    } else {
                        q[a] = a;
                    }
                });
            }
        }
        if (m) {
            D = {
                data: [],
                label: c.unitText,
                circular: false
            };
            for (e = 0; e < c.units.length; e++) {
                D.data.push({
                    value: e,
                    display: B[e]
                });
            }
            z[0].push(D);
        }
        A = l;
        return {
            wheels: z,
            minWidth: f && g ? 70 : 80,
            showLabel: false,
            formatValue: T,
            parseValue: function(l) {
                var q = (typeof l === 'number' ? l + '' : l) || c.defaultValue,
                    p = (q + '').split(' '),
                    d = +p[0],
                    j = [],
                    e, b = '';
                if (m) {
                    b = a.inArray(p[1], B);
                    b = b == -1 ? a.inArray(t, c.units) : b;
                    b = b == -1 ? 0 : b;
                }
                v = m ? c.units[b] : '';
                N(v);
                d = isNaN(d) ? 0 : d;
                d = P(d, o, n);
                e = E(d);
                e[1] = P(e[1], k, r);
                h = d;
                if (f) {
                    j[0] = e[0];
                    e[1] = Math.abs(e[1]);
                }
                j[i] = e[1];
                if (g) {
                    j[s] = e[2];
                }
                if (m) {
                    j[A] = b;
                }
                return j;
            },
            onCancel: function() {
                h = b;
            },
            validate: function(H) {
                var C, e, K, D, G, d = H.values,
                    B = H.index,
                    S = H.direction,
                    F = {},
                    y = [],
                    I = {},
                    z = m ? c.units[d[A]] : '';
                if (f && B === 0) {
                    h = Math.abs(h) * (d[0] == '-' ? -1 : 1);
                }
                if (B === i || B === s && g || h === b || B === b) {
                    h = R(d);
                    v = z;
                }
                if (m && (B === A && v !== z) || B === b) {
                    N(z);
                    h = x(h, v, z);
                    v = z;
                    e = E(h);
                    if (B !== b) {
                        I[i] = w;
                        u.changeWheel(I);
                    }
                    if (f) {
                        d[0] = e[0];
                    }
                }
                y[i] = [];
                if (f) {
                    y[0] = [];
                    if (o > 0) {
                        y[0].push('-');
                        d[0] = '+';
                    }
                    if (n < 0) {
                        y[0].push('+');
                        d[0] = '-';
                    }
                    G = Math.abs(d[0] == '-' ? k : r);
                    for (l = G + j; l < G + 20 * j; l += j) {
                        y[i].push(l);
                        F[l] = true;
                    }
                }
                h = P(h, o, n);
                e = E(h);
                K = f ? Math.abs(e[1]) : e[1];
                C = f ? d[0] == '-' : h < 0;
                d[i] = K;
                if (C) {
                    e[0] = '-';
                }
                if (g) {
                    d[s] = e[2];
                }
                a.each(g ? q : c.invalid, function(b, a) {
                    if (f && C) {
                        if (a <= 0) {
                            a = Math.abs(a);
                        } else {
                            return;
                        }
                    }
                    a = M(x(a, t, z), g ? 1 : p);
                    F[a] = true;
                    y[i].push(a);
                });
                d[i] = u.getValidValue(i, K, S, F);
                e[1] = d[i] * (f && C ? -1 : 1);
                if (g) {
                    y[s] = [];
                    var Q = f ? d[0] + d[1] : (h < 0 ? '-' : '+') + Math.abs(e[1]),
                        U = (o < 0 ? '-' : '+') + Math.abs(k),
                        T = (n < 0 ? '-' : '+') + Math.abs(r);
                    if (Q === U) {
                        a(J).each(function(b, a) {
                            if (C ? a > O : a < O) {
                                y[s].push(a);
                            }
                        });
                    }
                    if (Q === T) {
                        a(J).each(function(b, a) {
                            if (C ? a < L : a > L) {
                                y[s].push(a);
                            }
                        });
                    }
                    a.each(c.invalid, function(b, a) {
                        D = E(x(a, t, z));
                        if ((e[0] === D[0] || e[1] === 0 && D[1] === 0 && D[2] === 0) && e[1] === D[1]) {
                            y[s].push(D[2]);
                        }
                    });
                }
                return {
                    disabled: y,
                    valid: d
                };
            }
        };
    };
    c.presetShort('measurement');
}());
(function() {
    var a = mobiscroll,
        b = a.$,
        c = a.presets.scroller,
        e = {
            min: 0,
            max: 100,
            defaultUnit: 'km',
            units: ['m', 'km', 'in', 'ft', 'yd', 'mi']
        },
        d = {
            mm: 0.001,
            cm: 0.01,
            dm: 0.1,
            m: 1,
            dam: 10,
            hm: 100,
            km: 1000,
            'in': 0.0254,
            ft: 0.3048,
            yd: 0.9144,
            ch: 20.1168,
            fur: 201.168,
            mi: 1609.344,
            lea: 4828.032
        };
    a.presetShort('distance');
    c.distance = function(a) {
        var f = b.extend({}, e, a.settings);
        b.extend(a.settings, f, {
            sign: false,
            convert: function(a, b, c) {
                return a * d[b] / d[c];
            }
        });
        return c.measurement.call(this, a);
    };
}());
(function() {
    var a = mobiscroll,
        b = a.$,
        c = a.presets.scroller,
        e = {
            min: 0,
            max: 100,
            defaultUnit: 'N',
            units: ['N', 'kp', 'lbf', 'pdl']
        },
        d = {
            N: 1,
            kp: 9.80665,
            lbf: 4.448222,
            pdl: 0.138255
        };
    a.presetShort('force');
    c.force = function(a) {
        var f = b.extend({}, e, a.settings);
        b.extend(a.settings, f, {
            sign: false,
            convert: function(a, b, c) {
                return a * d[b] / d[c];
            }
        });
        return c.measurement.call(this, a);
    };
}());
(function() {
    var a = mobiscroll,
        b = a.$,
        c = a.presets.scroller,
        e = {
            min: 0,
            max: 1000,
            defaultUnit: 'kg',
            units: ['g', 'kg', 'oz', 'lb'],

            unitNames: {
                tlong: 't (long)',
                tshort: 't (short)'
            }
        },
        d = {
            mg: 0.001,
            cg: 0.01,
            dg: 0.1,
            g: 1,
            dag: 10,
            hg: 100,
            kg: 1000,
            t: 1000000,
            drc: 1.7718452,
            oz: 28.3495,
            lb: 453.59237,
            st: 6350.29318,
            qtr: 12700.58636,
            cwt: 50802.34544,
            tlong: 1016046.9088,
            tshort: 907184.74
        };
    a.presetShort('mass');
    c.mass = function(a) {
        var f = b.extend({}, e, a.settings);
        b.extend(a.settings, f, {
            sign: false,
            convert: function(a, b, c) {
                return a * d[b] / d[c];
            }
        });
        return c.measurement.call(this, a);
    };
}());
(function() {
    var a = mobiscroll,
        b = a.$,
        c = a.presets.scroller,
        e = {
            min: 0,
            max: 100,
            defaultUnit: 'kph',
            units: ['kph', 'mph', 'mps', 'fps', 'knot'],
            unitNames: {
                kph: 'km/h',
                mph: 'mi/h',
                mps: 'm/s',
                fps: 'ft/s',
                knot: 'knot'
            }
        },
        d = {
            kph: 1,
            mph: 1.60934,
            mps: 3.6,
            fps: 1.09728,
            knot: 1.852
        };
    a.presetShort('speed');
    c.speed = function(a) {
        var f = b.extend({}, e, a.settings);
        b.extend(a.settings, f, {
            sign: false,
            convert: function(a, b, c) {
                return a * d[b] / d[c];
            }
        });
        return c.measurement.call(this, a);
    };
}());
(function() {
    var a = mobiscroll,
        b = a.$,
        c = a.presets.scroller,
        d = {
            min: -20,
            max: 40,
            defaultUnit: 'c',
            units: ['c', 'k', 'f', 'r'],
            unitNames: {
                c: '°C',
                k: 'K',
                f: '°F',
                r: '°R'
            }
        },
        e = {
            c2k: function(a) {
                return a + 273.15;
            },
            c2f: function(a) {
                return a * 9 / 5 + 32;
            },
            c2r: function(a) {
                return (a + 273.15) * 9 / 5;
            },
            k2c: function(a) {
                return a - 273.15;
            },
            k2f: function(a) {
                return a * 9 / 5 - 459.67;
            },
            k2r: function(a) {
                return a * 9 / 5;
            },
            f2c: function(a) {
                return (a - 32) * 5 / 9;
            },
            f2k: function(a) {
                return (a + 459.67) * 5 / 9;
            },
            f2r: function(a) {
                return a + 459.67;
            },
            r2c: function(a) {
                return (a - 491.67) * 5 / 9;
            },
            r2k: function(a) {
                return a * 5 / 9;
            },
            r2f: function(a) {
                return a - 459.67;
            }
        };
    a.presetShort('temperature');
    c.temperature = function(a) {
        var f = b.extend({}, d, a.settings);
        b.extend(a.settings, f, {
            sign: true,
            convert: function(a, b, c) {
                return e[b + '2' + c](a);
            }
        });
        return c.measurement.call(this, a);
    };
}());